package com.shine.dao.impl;

import com.shine.dao.ShuiHuDao;
import com.shine.entity.ShuiHu;
import com.shine.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

/**
 * 持久层实现类
 */
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

public class ShuiHuDaoImpl implements ShuiHuDao {
    private QueryRunner queryRunner = new QueryRunner(JDBCUtils.getDataSource());

    @Override
    public Integer insertShuiHu(ShuiHu shuiHu) {
        return null;
    }

    @Override
    public Integer deleteShuiHu(Integer id) {
        return null;
    }

    @Override
    public Integer updateShuiHu(ShuiHu shuiHu) {
        return null;
    }

    @Override
    public ShuiHu selectShuiHuById(Integer id) {
        return null;
    }

    @Override
    public ShuiHu selectShuiHuByUsername(String username) {
        return null;
    }

    @Override
    public List<ShuiHu> selectAllShuiHu() throws IOException, SQLException {
        List<ShuiHu> shuiHus = queryRunner.query(JDBCUtils.getConnection(), "select * from shuihu", new BeanListHandler<>(ShuiHu.class));
        return shuiHus;
    }
}
